<?php

if(IsSet($_GET["view"])){ 
$viewFile = $_GET["view"];

 if (file_exists($viewFile)) {

    //Tutor help http://users.encs.concordia.ca/~s_chingw/soen287/DownloadFile/
    ob_start();	
    header('Content-Description: File Transfer');
    header('Content-Type: application/force-download'); 
    header('Content-Disposition: attachment; filename='.basename($viewFile));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length:'.filesize($viewFile));
    ob_end_flush();

    readfile($viewFile);
    exit;
  }
  else{exit(4);}
} //Close If statement


if(IsSet($_GET["print"])){

//header("Content-Type: text/plain");
//$printFile = $_GET["print"];
//print $printFile;
     
  }
  else{exit(4);}


?>
